package Class.Constructor.This;

/**
 * Enjoy programming!!!
 * Time: 2021/11/8 -  20:20
 */
public class Test00 {
    public static void main(String[] args){
        Person p1 = new Person("jack", 18);
        Person p2 = new Person("mary", 20);
        System.out.println("比较结果是：" + p1.compareTo(p2));
    }
}
class Person{
    String name;
    int age;
    public Person(String name, int age){
        this.name = name;
        this.age = age;
    }

    public boolean compareTo(Person o){
return this.name.equals(o.name) && this.age == o.age;
        }
    }

